package com.cci.kangdao.dao;

import java.util.Map;

import org.apache.ibatis.annotations.Select;
import org.mybatis.spring.annotation.MapperScan;

import com.cci.kangdao.dao.model.RelationShipT;


/**
 * 
 *
 */
@MapperScan
public interface RelationShipTDao {
	
	/**
	 * 根据用户名称获取clientid
	 * @param type
	 * @return
	 */
	@Select("select * from RelationShip_T a where a.UserName=#{UserName}")
	public RelationShipT getClientIdByUserName(Map<String, Object> map);

	/**
	 * 根据用户名称获取clientid
	 * @param userName 用户名称
	 * @return RelationShipT
	 */
	@Select("select top 1 * from RelationShip_T a where a.UserName=#{UserName}")
	public RelationShipT getClientIdByUserNameString(String userName);

	/**
	 * 根据用户id获取clientid
	 * @param userId 用户Id
	 * @return RelationShipT
	 */
	@Select("select relation.* from RelationShip_T relation inner join User_T users on users.Flag = 0 and users.UserName = relation.UserName and users.ID = #{userId}")
	public RelationShipT getClientIdByUserId(Long userId);
}
